package com.wang.Test;

import com.wang.Dao.UserDao;
import com.wang.Dao.UserDaoImpl;
import com.wang.Dao.UserDaoMySqlImpl;
import com.wang.Dao.UserDaoOracleImpl;
import com.wang.Service.UserServiceImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @Author 19225
 * @create 2020/11/25 11:49
 */
public class         T {
    public static void main(String[] args) {
       /* UserServiceImpl userService = new UserServiceImpl();
        userService.getUser();//原来的方法，需要更改service层方法
        userService.setUserDao(new UserDaoImpl());
        userService.setUserDao(new UserDaoMySqlImpl());
        userService.setUserDao(new UserDaoOracleImpl());
        //这样就可以通过set方法去调取不同的接口 不需要再去更改service层的东西*/
        ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
        UserServiceImpl userService= (UserServiceImpl) context.getBean("ServiceImpl");
        userService.getUser();
    }

}
